import UIBase from "./UIBase";

const { ccclass, property } = cc._decorator;

@ccclass
export default class UIWindow extends UIBase {
    private _viewSize: cc.Size = null;
    @property({ visible: true, displayName: "拦截区域", tooltip: "√上,拦截区域就是屏幕大小;不勾上,拦截区域就是这个UI页面的大小" })
    private _isFullScreen: boolean = false;
    init(...rest: any[]): void {
        //获取屏幕的大小
        this._viewSize = cc.view.getDesignResolutionSize();
        //点击拦截
        this._blockInput();
        //继承基类的寻找节点和初始数据
        super.init.apply(this, arguments);

    }


    private _blockInput() {
        let blockNode = new cc.Node();
        blockNode.parent = this.node;
        blockNode.setSiblingIndex(-100);
        //设置节点大小
        blockNode.setContentSize(this.node.getContentSize());
        if (this._isFullScreen) {
            let x = this.node.position.x;
            let y = this.node.position.y;
            //设置节点位置
            blockNode.setPosition(-x, -y);
            blockNode.setContentSize(this._viewSize);
        }
        //添加拦截组件
        //blockNode.addComponent(BlockInputEvents);

    }
}


